<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class IntegralGoodsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'detail' => 'required',
            'price' => 'required|numeric',
        ];
    }

    public function messages()
    {
        return [
           'name.required' => '商品名不能为空',
           'detail.required' => '商品详情不能为空',
           'price.required' => '商品价格不能为空',
           'price.numeric' => '商品价格只能为数字',
        ];
    }
}
